package cn.wolfcode.lww.service.impl;

import cn.wolfcode.lww.domain.Strategy;
import cn.wolfcode.lww.domain.Travelnotes;
import cn.wolfcode.lww.mapper.TravelnotesMapper;
import cn.wolfcode.lww.service.TravelnotesService;
import cn.wolfcode.lww.util.QueryObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class TravelnotesServiceImpl implements TravelnotesService {
    @Autowired
    TravelnotesMapper travelnotesMapper;
    @Override
    public int deleteByPrimaryKey(String id) {
        return 0;
    }

    @Override
    public int insert(Travelnotes record) {
        return 0;
    }

    @Override
    public PageInfo<Travelnotes> selectAll(QueryObject queryObject) {
        PageHelper.startPage(queryObject.getCurrentPage(),queryObject.getPageSize());
        List<Travelnotes> travelnotes = travelnotesMapper.selectAll();
        return new PageInfo<Travelnotes>(travelnotes);
    }

    @Override
    public int updateByPrimaryKey(Travelnotes record) {
        return 0;
    }

    @Override
    public  Travelnotes selectAllByIdAfter(String id){
        Travelnotes travelnotes = travelnotesMapper.selectAllByIdAfter(id);
        return travelnotes;
    };

    @Override
    public PageInfo<Travelnotes> searchAllByTitle(QueryObject queryObject,String title){

        List<Travelnotes> travelnotes = travelnotesMapper.searchAllByTitle(title);
        PageHelper.startPage(queryObject.getCurrentPage(),queryObject.getPageSize());

        return new PageInfo<Travelnotes>(travelnotes);
    };
}
